//简单工厂模式 静态工厂方法 由一个工厂对象决定创建某一产品对象的实例
//篮球基类
var Basketball = function() {
    this.info = '篮球盛行美国'
}
Basketball.prototype = {
    getMember: function() {
        console.log('需要五名')
    },
    getSize: function() {
        console.log('篮球很大')
    }
}
//足球基类
var FootBall=function(){
    this.info='足球很流行'
}
FootBall.prototype={
    getMember:function(){
        console.log('需要11名')
    },
    getSize:function(){
        console.log('足球很大')
    }
}
//网球基类
var Tennis=function(){
    this.info='网球很流行'
}
Tennis.prototype={
    getMember:function(){
        console.log('需要1名')
    },
    getSize:function(){
        console.log('网球很大')
    }
}
//运动工厂
var SportFactory=function(name){
    switch(name){
        case 'NBA':
            return new Basketball();
        case 'wordcup':
            return new FootBall();
        case 'Frenchopen':
            return new Tennis();
    }
}
var football=SportFactory('wordcup')
console.log(football)
console.log(football.info)
football.getSize()
